(define (install-sum-package) 
  (define (make-sum a1 a2) (cons a1 a2)) 
  (define (addend s) (cadr s)) 
  (define (augend s) (caddr s)) 
  (define (deriv-sum s) 
    (make-sum (deriv (addend s)) (deriv (augend s)))) 

  (define (tag x) (attach-tag '+ x)) 
  (put 'deriv '(+) deriv-sum) 
  (put 'make-sum '+ 
       (lambda (x y) (tag (make-sum x y)))) 
  'done) 

(define (install-product-package) 
  (define (make-product m1 m2) (cons m1 m2)) 
  (define (multiplier p) (cadr p)) 
  (define (multiplicand p) (caddr p)) 
  (define (deriv-product p) 
    (make-sum 
      (make-product (multiplier exp) 
                    (deriv (multiplicand exp) var)) 
      (make-product (deriv (multiplier exp) var) 
                    (multiplicand exp)))) 

  (define (tag x) (attach-tag '* x)) 
  (put 'deriv '(*) deriv-product) 
  (put 'make-product '* 
       (lambda (x y) (tag (make-product x y)))) 
  'done) 

